package com.topnav.mc.admin.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.topnav.mc.admin.entity.OperateLog;
import com.topnav.mc.admin.entity.bean.OperateLogBean;
import com.topnav.mc.admin.entity.bean.SystemLogBean;
import com.topnav.mc.admin.entity.param.OperateLogParam;
import com.topnav.mc.admin.entity.param.SystemLogParam;
import com.topnav.mc.base.mc.McMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: kenny
 * @Date: 2024/3/29 17:13
 */
@Mapper
public interface OperateLogMapper extends McMapper<OperateLog, OperateLogBean, OperateLogParam> {
    String commSql = " SELECT l.*, u.login_name AS userCode,u.name AS userName, o.short_name AS orgName " +
            " FROM mc_operate_log l " +
            " LEFT JOIN mc_user u ON l.user_id = u.id " +
            " LEFT JOIN mc_organization o ON u.org_id = o.id " +
            " ${ew.customSqlSegment}";

    @Select(commSql)
    OperateLogBean selectInfoOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    List<OperateLogBean> selectInfoList(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    Page<OperateLogBean> selectInfoPage(Page<OperateLogParam> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
}
